package com.accenture.fd.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.accenture.fd.dao.ClassListDao;
import com.accenture.fd.dao.DtoSourceDao;
import com.accenture.fd.entity.DtoToSource;
import com.accenture.fd.service.ClassDesignService;
import com.accenture.fd.utils.generator.model.ClassToExcelModel;

@Service
public class ClassDesignServiceImpl implements ClassDesignService {

	@Autowired
	private ClassListDao classListDao;
	
	@Autowired
	private DtoSourceDao dtoSourceDao;

	public ClassToExcelModel getClassDesignModel(String screenId, String designId) {
		ClassToExcelModel classModel = classListDao.getClassDesignModel(screenId, designId);
		return classModel;
	}
	
	@Override
	public void saveDesignDtoList(List<DtoToSource> saveList) {
		dtoSourceDao.deleteById(saveList.get(0).getScreenId(), saveList.get(0).getClassId());
		
		dtoSourceDao.saveAll(saveList);
	}
}
